package com.raymond.client.config;


import com.raymond.client.constants.GlobalConstants;

/**
 * @version V3.0.0
 * @description: 客户端配置
 * @author: 刘彦宁
 * @date: 2020年06月05日10:51
 **/
public class ClientSocketConfig extends SocketConfig {

    /**
     * 唯一ID
     */
    private String id;


    /**
     * 滑动窗口size，默认16
     */
    private int windowSize = 256;

    /**
     * 请求超时时间（毫秒）
     */
    private long requestExpiryTimeout = 10000;

    /**
     * 请求超时时间（毫秒）
     */
    private long responseExpiryTimeout = 20000;


    /**
     * 最多可以连接的数量
     */
    private int channelSize;

    /**
     * 心跳超时时间,单位秒
     */
    private int idleTime;

    public ClientSocketConfig(String id, int windowSize, String host, int port) {
        this(id, windowSize, host, port, GlobalConstants.DEFAULT_CONNECT_EXPIRY_TIMEOUT);
    }


    public ClientSocketConfig(String id, int windowSize, String host, int port, long connectTimeout) {
        super(host, port, connectTimeout);
        this.id = id;
        this.windowSize = windowSize;
        this.requestExpiryTimeout = GlobalConstants.DEFAULT_REQUEST_EXPIRY_TIMEOUT;
        this.responseExpiryTimeout = GlobalConstants.DEFAULT_RESPONSE_EXPIRY_TIMEOUT;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        id = id;
    }


    public int getWindowSize() {
        return windowSize;
    }

    public void setWindowSize(int windowSize) {
        this.windowSize = windowSize;
    }

    public int getChannelSize() {
        return channelSize;
    }

    public void setChannelSize(int channelSize) {
        this.channelSize = channelSize;
    }

    public long getRequestExpiryTimeout() {
        return requestExpiryTimeout;
    }

    public int getIdleTime() {
        return idleTime;
    }

    public void setIdleTime(int idleTime) {
        this.idleTime = idleTime;
    }

    public void setRequestExpiryTimeout(long requestExpiryTimeout) {
        this.requestExpiryTimeout = requestExpiryTimeout;
    }

    public long getResponseExpiryTimeout() {
        return responseExpiryTimeout;
    }

    public void setResponseExpiryTimeout(long responseExpiryTimeout) {
        this.responseExpiryTimeout = responseExpiryTimeout;
    }
}
